<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>平台配置</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		
		//设置平台管理员
		function setAdmin(){
			var href="${ctx}/jiujiu/jiuManufactor/memberList?type=8";
			top.$.jBox.open('iframe:'+href,'选择用户',$(top.document).width()-800,$(top.document).height()-120,{
				buttons:{"关闭":true},
				loaded:function(h){
					$(".jbox-content", top.document).css("overflow-y","hidden");
					$(".nav,.form-actions,[class=btn]", h.find("iframe").contents()).hide();
					$("body", h.find("iframe").contents()).css("margin","10px");
				}
			});
			
			//定时刷新
			  window.setInterval(function(){ 
						$.getJSON("${ctx}/jiujiu/jiuWithdrawalsConfig/getConfig", function(data){
							if(data.gHeadimgurl!=null && data.gHeadimgurl!=''){
			                    $('#tu').attr('src',data.gHeadimgurl);
							}else{
								$('#tu').attr('src',"/jiujiu/userfiles/images/add.png");
							}
							if(data.gMemberName!=null && data.gMemberName!=''){
			                    $('#gMemberName').html(data.gMemberName);
							}
		                });
			}, 1000);
			
			return false;
		}
		
		//设置平台财务
		function setAdminCai(){
			var href="${ctx}/jiujiu/jiuManufactor/memberList?type=10";
			top.$.jBox.open('iframe:'+href,'选择用户',$(top.document).width()-800,$(top.document).height()-120,{
				buttons:{"关闭":true},
				loaded:function(h){
					$(".jbox-content", top.document).css("overflow-y","hidden");
					$(".nav,.form-actions,[class=btn]", h.find("iframe").contents()).hide();
					$("body", h.find("iframe").contents()).css("margin","10px");
				}
			});
			
			//定时刷新
			  window.setInterval(function(){ 
						$.getJSON("${ctx}/jiujiu/jiuWithdrawalsConfig/getConfig", function(data){
							if(data.cHeadimgurl!=null && data.cHeadimgurl!=''){
			                    $('#tuc').attr('src',data.cHeadimgurl);
							}else{
								$('#tuc').attr('src',"/jiujiu/userfiles/images/add.png");
							}
							if(data.cMemberName!=null && data.cMemberName!=''){
			                    $('#cMemberName').html(data.cMemberName);
							}
		                });
			}, 1000);
			
			return false;
		}
		
		//设置平台财务
		function setAdminKeFu(){
			var href="${ctx}/jiujiu/jiuManufactor/memberList?type=11";
			top.$.jBox.open('iframe:'+href,'选择用户',$(top.document).width()-800,$(top.document).height()-120,{
				buttons:{"关闭":true},
				loaded:function(h){
					$(".jbox-content", top.document).css("overflow-y","hidden");
					$(".nav,.form-actions,[class=btn]", h.find("iframe").contents()).hide();
					$("body", h.find("iframe").contents()).css("margin","10px");
				}
			});
			
			//定时刷新
			  window.setInterval(function(){ 
						$.getJSON("${ctx}/jiujiu/jiuWithdrawalsConfig/getConfig", function(data){
							if(data.kfHeadimgurl!=null && data.kfHeadimgurl!=''){
			                    $('#tukf').attr('src',data.kfHeadimgurl);
							}else{
								 $('#tukf').attr('src',"/jiujiu/userfiles/images/add.png");
							}
							if(data.kfMemberName!=null && data.kfMemberName!=''){
			                    $('#kfMemberName').html(data.kfMemberName);
							}
		                });
			}, 1000);
			
			return false;
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<%-- <li><a href="${ctx}/jiujiu/jiuWithdrawalsConfig/">提现配置列表</a></li> --%>
		<li class="active"><a href="${ctx}/jiujiu/jiuWithdrawalsConfig/form?id=${jiuWithdrawalsConfig.id}">平台配置<shiro:hasPermission name="jiujiu:jiuWithdrawalsConfig:edit">${not empty jiuWithdrawalsConfig.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="jiujiu:jiuWithdrawalsConfig:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="jiuWithdrawalsConfig" action="${ctx}/jiujiu/jiuWithdrawalsConfig/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="userId"/>
		<tags:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">每积分可提金额:</label>
			<div class="controls">
				<form:input path="money" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">可提现的最小额度:</label>
			<div class="controls">
				<form:input path="reachMoney" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">提现手续费百分比（小数）:</label>
			<div class="controls">
				<form:input path="poundage" htmlEscape="false" />
			</div>
		</div>
		
		<br/><br/><br/>
		<div class="control-group">
			<label class="control-label">平台管理员:</label>
			<div class="controls">
				<div class="control">
					<c:if test="${not empty jiuWithdrawalsConfig.gHeadimgurl}">
						<a href="javascript:setAdmin()"><img id="tu" src="${jiuWithdrawalsConfig.gHeadimgurl}" style="width:40px;height:40px"/> </a>
					</c:if>
					<c:if test="${empty jiuWithdrawalsConfig.gHeadimgurl}">
						<a href="javascript:setAdmin()"><img id="tu" src="/jiujiu/userfiles/images/add.png" style="width:40px;height:40px"></a>
					</c:if>
		      		<c:if test="${not empty jiuWithdrawalsConfig.gMemberName}">
		      			<span id="gMemberName">${jiuWithdrawalsConfig.gMemberName}</span>
		      		</c:if>
					<c:if test="${empty jiuWithdrawalsConfig.gMemberName}">
						<span id="gMemberName"></span>
					</c:if>
		      	</div>
			</div>
		</div>
		
		<br/>
		<div class="control-group">
			<label class="control-label">平台财务:</label>
			<div class="controls">
				<c:if test="${not empty jiuWithdrawalsConfig.cHeadimgurl}">
					<a href="javascript:setAdminCai()"><img id="tuc" src="${jiuWithdrawalsConfig.cHeadimgurl}" style="width:40px;height:40px"/> </a>
				</c:if>
				<c:if test="${empty jiuWithdrawalsConfig.cHeadimgurl}">
					<a href="javascript:setAdminCai()"><img id="tuc" src="/jiujiu/userfiles/images/add.png" style="width:40px;height:40px"></a>
				</c:if>
	      		<c:if test="${not empty jiuWithdrawalsConfig.cMemberName}">
	      			<span id="cMemberName">${jiuWithdrawalsConfig.cMemberName}</span>
	      		</c:if>
				<c:if test="${empty jiuWithdrawalsConfig.cMemberName}">
					<span id="cMemberName"></span>
				</c:if>
			</div>
		</div>
		
		<br/>
		<div class="control-group">
			<label class="control-label">平台客服:</label>
			<div class="controls">
				<c:if test="${not empty jiuWithdrawalsConfig.kfHeadimgurl}">
					<a href="javascript:setAdminKeFu()"><img id="tukf" src="${jiuWithdrawalsConfig.kfHeadimgurl}" style="width:40px;height:40px"/> </a>
				</c:if>
				<c:if test="${empty jiuWithdrawalsConfig.kfHeadimgurl}">
					<a href="javascript:setAdminKeFu()"><img id="tukf" src="/jiujiu/userfiles/images/add.png" style="width:40px;height:40px"></a>
				</c:if>
	      		<c:if test="${not empty jiuWithdrawalsConfig.kfMemberName}">
	      			<span id="kfMemberName">${jiuWithdrawalsConfig.kfMemberName}</span>
	      		</c:if>
				<c:if test="${empty jiuWithdrawalsConfig.kfMemberName}">
					<span id="kfMemberName"></span>
				</c:if>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">设置导出加密:</label>
			<div class="controls">
				<form:input path="password" htmlEscape="false" />
			</div>
		</div>
		
		<div class="form-actions">
			<shiro:hasPermission name="jiujiu:jiuWithdrawalsConfig:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
